<?php

namespace App;

use App\Model;

class Fan extends Model
{
    //获取某个用户关注数
    public function user($user_id)
    {
        return $this->belongsToMany('\App\User', 'users', 'user_id', 'id');
    }

    //粉丝用户
    public function fuser()
    {
        return $this->hasOne(App\User::class, 'id', 'fan_id');
    }

    //关注用户
    public function suser()
    {
        return $this->hasOne(App\User::class , 'id', 'star_id');
    }
}
